# 构建该项目的基础镜像
FROM golang:1.20 as builder

RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://goproxy.cn,direct

RUN go env -w GOPRIVATE=git.ichub.com
RUN go env -w GOINSECURE=git.ichub.com
    
# 添加作者信息
LABEL maintainer="leijmdas <leijmdas@163.com>"


COPY ./go-general /go-general

WORKDIR /go-general
# 下载所有的依赖
RUN ls -lrt /go-general

RUN go mod tidy

# 编译GO程序
RUN go build -o main ./general/ichubengine/ichubengineserver/ruleserver.go

#FROM alpine:latest
RUN ls -lrt main
RUN mkdir -p /root/app
RUN mkdir -p /root/app/baseconfig
RUN mkdir -p /root/app/data

RUN cp main /root/app
COPY ./go-general/docker/docker-ichubdbagent/config /root/app/config

# 通过EXPOSE对外暴露服务的端口号
RUN  ls -lrt /root/app/*
EXPOSE 88
WORKDIR /root/app

# 通过下面的命令来运行可执行文件
CMD ["/root/app/main"]


